// pages/consultFile/sift/sift.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    region:["河南省","郑州市","中原区"],    //定义一个空数组用来存放选择地具体是哪一个省市区
    biaoqian:["全部","恋爱关系","婚姻家庭","个人成长","恋爱关系","全部","个人成长","恋爱关系","全部","全部","个人成长","全部"],
    zixunshi:"国家二级心理咨询师",
    conlevel:[],
    zixunshiSex:["男","女","不限"],
    zixunfangshi:["全部方式","视频咨询","语音咨询"],
    // biaoqian2Color:"white",
    backgroundColor:"white",
    backgroundColor2:"white",
    backgroundColor3:"white",
    fangshibackgroundColor:"white",
    fangshibackgroundColor2:"white",
    fangshibackgroundColor3:"white"
  },
  getUserProvince:function(e)
      {
         this.setData({
             region:e.detail.value,//将用户选择的省市区赋值给region
         }),
         console.log(this.__data__.region)
  },
  // 咨询师等级
  choosezixunshi:function(){
    var itthis=this;
    console.log(itthis.data.conlevel);
    wx.showActionSheet({
      itemList: ['请选择',itthis.data.conlevel[0].conlevelName, itthis.data.conlevel[1].conlevelName,itthis.data.conlevel[2].conlevelName],
      success: function (res) {
        if (this.originArgs.itemList[res.tapIndex]!='请选择') {
          itthis.setData({
            zixunshi:this.originArgs.itemList[res.tapIndex]
          })
        }      
      }
    })
  },
  // choosebiaoqian2Color:function(){
  //   if (this.data.biaoqian2Color!="#87cefa") {
  //     this.setData({
  //       biaoqian2Color:"#87cefa"
  //     }) 
  //   }else{
  //     this.setData({
  //       biaoqian2Color:"white"
  //     }) 
  //   }
      
  // },
  biaoqian2Choose:function(e){
    console.log(e)
    var sex=e._relatedInfo.anchorRelatedText;
    console.log(sex)
    if (this.data.backgroundColor=="white") {
      this.setData({
        backgroundColor:"#87cefa"
      })
    }else{
      this.setData({
        backgroundColor:"white"
      })
    }     
 },
 biaoqian2Choosenv:function(e){
  console.log(e)
  var sex=e._relatedInfo.anchorRelatedText;
  console.log(sex)
  if (this.data.backgroundColor2=="white") {
    this.setData({
      backgroundColor2:"#87cefa"
    })
  }else{
    this.setData({
      backgroundColor2:"white"
    })
  }     
},
biaoqian2Choosebu:function(e){
  console.log(e)
  var sex=e._relatedInfo.anchorRelatedText;
  console.log(sex)
  if (this.data.backgroundColor3=="white") {
    this.setData({
      backgroundColor3:"#87cefa"
    })
  }else{
    this.setData({
      backgroundColor3:"white"
    })
  }     
},
fangshibackgroundColor:function(e){
  console.log(e)
  var sex=e._relatedInfo.anchorRelatedText;
  console.log(sex)
  if (this.data.fangshibackgroundColor=="white") {
    this.setData({
      fangshibackgroundColor:"#87cefa"
    })
  }else{
    this.setData({
      fangshibackgroundColor:"white"
    })
  }     
},
fangshibackgroundColor2:function(e){
console.log(e)
var sex=e._relatedInfo.anchorRelatedText;
console.log(sex)
if (this.data.fangshibackgroundColor2=="white") {
  this.setData({
    fangshibackgroundColor2:"#87cefa"
  })
}else{
  this.setData({
    fangshibackgroundColor2:"white"
  })
}     
},
fangshibackgroundColor3:function(e){
console.log(e)
var sex=e._relatedInfo.anchorRelatedText;
console.log(sex)
if (this.data.fangshibackgroundColor3=="white") {
  this.setData({
    fangshibackgroundColor3:"#87cefa"
  })
}else{
  this.setData({
    fangshibackgroundColor3:"white"
  })
}     
},
    biaoqian3Choose:function(e){
      console.log(e)
      var manner=e._relatedInfo.anchorRelatedText;
      console.log(manner)
      },
    
  // },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that=this;
    wx.request({
      url: 'http://localhost:8080/conlevel/listAll',
      success(resp){
       that.setData({
        conlevel:resp.data
       })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
      
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})